<?php include("../includes/header-admin.php") ?>
<title>LazySwim</title>
<link rel="stylesheet" href="store.css" type="text/css" />
</head>

<body>
<div id="page">
    <div id="page-top">
        <div id="page-bottom">
          <div id="header">
                <div id="header-info">
                    <h1>LAZYSWIM</h1>
                    <div class="description">Simplistic Swim System</div>
                </div>
				<!-- Header Goes Here -->
                <?php printHeader(); ?>
				<!-- Header Ends Here -->
                <div id="header-date">Today is <?php echo date('l, F jS, Y'); ?></div>
                <div id="header-cats">
				<!-- Welcome Message Starts Here -->
                    <ul>
					<?php include("../../includes/welcomeBar.php"); ?>
					</ul>
				<!-- Welcome Message Ends Here -->	
                </div>
            </div>
            <div id="main">

                <div id="sidebar">
                    <?php
					// include the corresponding navigation page
                    include("../../includes/navigation.php");
					?>     
                </div>

            <!-- main body -->
 			<div class="featured-post"> 
			
				<div class="post-title"><h2> <a href="index.php">Manage Store</a> - Confirm Orders</h2></div>
				<div class="post-entry">

	     Below is the order you selected. Please confirm you wish to order these amounts of each item. 
	     Otherwise, please modify your order.
	    <br><br>
	     <form action="processOrders.php" method="post">
	         <input type="submit" value="Modify Order">
	     </form><br><br>	            

            <form name="myForm" method="post" action="orderEquip.php" >
	         <table width="40%"><tr><th>Product</th><th>Quantity</th>
                <?php
                     $productIDs = $_POST['selected'];
			$i = 0;
			foreach( $productIDs AS $id ) {
			// this is just to make the table pretty with alternating tr colours
                        if($i % 2) { 
                            $class = 'row1'; 
                        } 
                        else { 
                            $class = 'row2'; 
                        } 
                        $i++;

			$product = mysql_query("SELECT name FROM products WHERE productID = '$id'") or die(mysql_error());
			$product = mysql_fetch_row($product);
			$quantity = $_POST['quantity_' . $id];
		  ?>
			 <tr class="<?php echo $class; ?>"> 
                            <td align="center"><?php echo $product[0]; ?></td> 
				<td align="center"><?php echo $quantity; ?></td> 
				<input type="hidden" name="<?php echo $id; ?>" value="<?php echo $quantity; ?>">
                        </tr> 
		  <?php
			}
                ?>       
                    <tr><td colspan=3 align="right"><input type="submit" value="Order Items"></td></tr>
                </table>
                </form>

				<!-- end of main -->
				</div>
			</div>

                <div class="clear"></div>

            </div>
			<!-- Footer Goes Here -->
            <?php include("../../includes/footer.php"); ?>
			<!-- Footer Ends Here -->
        </div>
    </div>
</div>
</body>
